package com.accesshollywood.grfxOrdering.orderTreeSpecial;

import java.awt.Component;
import java.awt.FlowLayout;
import java.awt.dnd.DropTarget;

import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTree;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.TreeCellRenderer;

import com.accesshollywood.grfxOrdering.orderTreeSpecial.models.ApprTableModel;
import com.accesshollywood.grfxOrdering.orderTreeSpecial.models.ItemTableModel;
import com.accesshollywood.grfxOrdering.orderTreeSpecial.models.NotesTableModel;
import com.accesshollywood.grfxOrdering.orderTreeSpecial.models.SpecificsTableModel;
import com.accesshollywood.grfxOrdering.orderTreeSpecial.models.SummaryTableModel;
import com.accesshollywood.grfxOrdering.orderTreeSpecial.nodes.ApprTreeNode;
import com.accesshollywood.grfxOrdering.orderTreeSpecial.nodes.ItemTreeNode;
import com.accesshollywood.grfxOrdering.orderTreeSpecial.nodes.NotesTreeNode;
import com.accesshollywood.grfxOrdering.orderTreeSpecial.nodes.SpecificsTreeNode;
import com.accesshollywood.grfxOrdering.orderTreeSpecial.nodes.SummaryTreeNode;
import com.accesshollywood.indexables.GrfxOrder;

public class TreeAsTablesRendererMaster extends JPanel{// implements TreeCellRenderer{
	/*
	public OrderTree tree;
	public SummaryTreeNode summaryTreeNode;
	public ApprTreeNode apprTreeNode;
	public ItemTreeNode itemTreeNode;
	public SpecificsTreeNode specificsTreeNode;
	public NotesTreeNode notesTreeNode;
	
	public TreeAsTablesRendererMaster() {
	}

	@Override
	public Component getTreeCellRendererComponent(JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) {
		this.tree = (OrderTree)tree;
		DefaultMutableTreeNode node = (DefaultMutableTreeNode) value;
		Object userObject = node.getUserObject();

		this.removeAll();
		FlowLayout newFlow = new FlowLayout();
		newFlow.setHgap(0);
		newFlow.setVgap(2);
		this.setLayout(newFlow);
		if (leaf) {
			if (value instanceof ApprTreeNode){
				//
				apprTreeNode = (ApprTreeNode) value;
				ApprTableModel apprModel = ((apprTreeNode).model);
				(apprTreeNode).adjPanel(this,apprModel);
				tree.setToolTipText("<html>Researcher: " + apprModel.grfxOrder.getResearcher() + "<br>" +
									"PhotoEdit: "    + apprModel.grfxOrder.getPhotoEdit() + "<br>" +
									"Legal: " 	 	 + apprModel.grfxOrder.getLegal() + "<br><br>" +
									"Destination: "	 + apprModel.grfxOrder.getDestination() + "<br>"
				);
				//
			} else if (value instanceof SpecificsTreeNode) {
				//
				specificsTreeNode = (SpecificsTreeNode) value;
				SpecificsTableModel currSpecifics = ((specificsTreeNode).model);
				(specificsTreeNode).adjPanel(this,currSpecifics);
				//
			} else if (value instanceof ItemTreeNode){
				//
				itemTreeNode = (ItemTreeNode) value;
				ItemTableModel currItems = ((itemTreeNode).model);
				itemTreeNode.adjPanel(this,currItems);
				//this.setTransferHandler(OrderTree.handler); // enables drag-n-drop
				//this.tree.target = new DropTarget(this,this.tree);
				//
			} else if (value instanceof NotesTreeNode) {
				//
				notesTreeNode = (NotesTreeNode) value;
				NotesTableModel notes = ((notesTreeNode).model);
				(notesTreeNode).adjPanel(this,notes);
				//
			}
		} else if (value instanceof GrfxOrder) {
			summaryTreeNode = new SummaryTreeNode((GrfxOrder) value);
			SummaryTableModel currOrder = (SummaryTableModel)(summaryTreeNode.model);
			summaryTreeNode.subPanel = new SummaryPanel(tree, row, currOrder);
			add(summaryTreeNode.subPanel);
		} else {
			add(new JLabel("ORDERS"));
		}
		return this;
	}
	*/
}
